//
//  CYContactUsViewController.m
//  cyydt
//
//  Created by chu on 2019/2/4.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYContactUsViewController.h"

@interface CYContactUsViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *backViewHeightConstraint;
@property (weak, nonatomic) IBOutlet UIImageView *phoneImageView;
@property (weak, nonatomic) IBOutlet UIImageView *qqImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *oneHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *twoHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *threeHeightConstraint;

@end

@implementation CYContactUsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"联系我们";
    self.oneHeightConstraint.constant = 157 * kWindowHOne;
    self.twoHeightConstraint.constant = 175 * kWindowHOne;
    self.threeHeightConstraint.constant = 175 * kWindowHOne;

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(call:)];
    [self.phoneImageView addGestureRecognizer:tap];
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(qq:)];
    [self.qqImageView addGestureRecognizer:tap1];
}

- (void)call:(UITapGestureRecognizer *)tap{
    NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"4000158959"];
    NSURL *url = [NSURL URLWithString:str];
    [EasyShowLodingView showLoding];
    if (@available(iOS 10.0, *)) {
        [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
            [EasyShowLodingView hidenLoding];
        }];
    } else {
        // Fallback on earlier versions
        [[UIApplication sharedApplication] openURL:url];
    }
}

- (void)qq:(UITapGestureRecognizer *)tap{
    NSString *qq = [NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",@"1226265959"];
    NSURL *url = [NSURL URLWithString:qq];
    [EasyShowLodingView showLoding];
    if (@available(iOS 10.0, *)) {
        [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
            [EasyShowLodingView hidenLoding];
        }];
    } else {
        // Fallback on earlier versions
        [[UIApplication sharedApplication] openURL:url];
    }
    
}

- (void)updateViewConstraints{
    [super updateViewConstraints];
    self.backViewHeightConstraint.constant = CGRectGetMaxY(self.qqImageView.frame) + 20;
}


@end
